package com.haier.npt.security.event.listener;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

import com.haier.npt.security.cache.SysPermissionCacheService;
import com.haier.npt.security.event.UserPermissionChangeEvent;


@Component
public class UserPermissionChangeEventListener implements ApplicationListener<UserPermissionChangeEvent> {
	
	@Autowired
	private SysPermissionCacheService permissionCheckService; 
	
	@Override
	public void onApplicationEvent(UserPermissionChangeEvent event) {
		/**
		 * 清除缓存
		 */
		permissionCheckService.clearCache(); 
		
		/**
		 * 重新加载
		 */
		permissionCheckService.loadPermissionCache(); 
	}
}
